﻿Public Class FormTypeEditor

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        If txtTypeId.Enabled Then
            Cmd.ExecuteNonQuery("INSERT INTO Type VALUES(N'" & txtTypeName.Text & "',1)")
        Else
            Cmd.ExecuteNonQuery("UPDATE Type SET TypeName=N'" & txtTypeName.Text & "' WHERE TypeId='" & txtTypeId.Text & "'")
        End If

        Me.DialogResult = Windows.Forms.DialogResult.OK

    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub

    Private Sub FormTypeEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class